BEGIN;
CREATE TABLE "malware_process" (
    "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
    "name" varchar(1000) NOT NULL,
    "base_path" varchar(2000) NOT NULL,
    "full_path" varchar(2000) NOT NULL,
    "md5_hash" varchar(1000) NOT NULL,
    "insertion_date" datetime NOT NULL,
    "process_state" varchar(100),
    "file_size" varchar(1000) NOT NULL
)
;
CREATE TABLE "malware_teamcymru_scan" (
    "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
    "last_seen" datetime NOT NULL,
    "percent_detection" integer NOT NULL,
    "process_id" integer NOT NULL REFERENCES "malware_process" ("id"),
    "ismalware" bool NOT NULL
)
;
CREATE TABLE "malware_virustotal_scan" (
    "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
    "scan_date" datetime NOT NULL,
    "virustotal_scan_date" datetime NOT NULL,
    "process_id" integer NOT NULL REFERENCES "malware_process" ("id"),
    "isvirus" bool NOT NULL
)
;
CREATE TABLE "malware_virustotalscan_details" (
    "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
    "virus_engine" varchar(1000) NOT NULL,
    "virus_name" varchar(1000) NOT NULL,
    "virustotal_scan_id" integer NOT NULL REFERENCES "malware_virustotal_scan" ("id")
)
;
CREATE INDEX "malware_process_4da47e07" ON "malware_process" ("name");
CREATE INDEX "malware_process_a3f1f5ea" ON "malware_process" ("md5_hash");
CREATE INDEX "malware_process_3755a603" ON "malware_process" ("insertion_date");
CREATE INDEX "malware_teamcymru_scan_55178f52" ON "malware_teamcymru_scan" ("process_id");
CREATE INDEX "malware_virustotal_scan_55178f52" ON "malware_virustotal_scan" ("process_id");
CREATE INDEX "malware_virustotalscan_details_563b2838" ON "malware_virustotalscan_details" ("virustotal_scan_id");

COMMIT;
